package kaiao.dynamic;

public class 爬楼梯 {

	public static void main(String[] args) {
		int n = 1;

		int[] p = new int[n];
		p[0] = 1;
		p[1] = 2;
		// 先定义已知值，之后根据规律动态计算
		for (int i = 2; i < n; i++) {
			p[i] = p[i-1] + p[i-2];
		}
		int x = p[n-1];

	}

	public int climbStairs(int n) {
		int[] p = new int[n + 1];
		p[0] = 1;
		p[1] = 1;
		// 先定义已知值，之后根据规律动态计算
		for (int i = 2; i < n + 1; i++) {
			p[i] = p[i-1] + p[i-2];
		}
		return p[n];
	}
}
